cmake_minimum_required(VERSION 3.5)
project(perception_fusion)

if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 14)
endif()
add_compile_options(
  -O3
  -g
)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(FUSION_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}") 
message("FUSION_INCLUDE_DIRS: << " ${FUSION_INCLUDE_DIRS})
set(FUSION_LINKER_LIBS "")
set(FUSION_LIB_NAME_PREFIX ${PROJECT_NAME})
# =============================
# add modules
# =============================
add_subdirectory(proto)
add_subdirectory(utils/base)
add_subdirectory(utils/common)
add_subdirectory(utils/lib)
add_subdirectory(modules/lib/gatekeeper/pbf_gatekeeper/proto)
add_subdirectory(modules)

message("PROJECT_SOURCE_DIR: << " ${PROJECT_SOURCE_DIR})
include_directories(
	${FUSION_INCLUDE_DIRS}
)

file(GLOB SRC_PERCEPTION_FUSION_MAIN
  "${PROJECT_SOURCE_DIR}/main.cc"
)

file(GLOB SRC_PERCEPTION_FUSION_TEST
  "test/unit_test.cc"
  "modules/lib/fusion_system/probabilistic_fusion/probabilistic_fusion_test.cc"
)
message("FUSION_LINKER_LIBS: << " ${FUSION_LINKER_LIBS})

add_executable(unit_test ${SRC_PERCEPTION_FUSION_TEST})
target_link_libraries(unit_test   
  ${FUSION_LINKER_LIBS}
  ${PROTOBUF_LIBRARY}
  glog
  yaml-cpp
  gtest
  gtest_main
  pthread
  )

add_executable(${PROJECT_NAME} ${SRC_PERCEPTION_FUSION_MAIN})

target_link_libraries(${PROJECT_NAME}
  ${FUSION_LINKER_LIBS}
  ${PROTOBUF_LIBRARY}
  glog
  yaml-cpp
)

install(DIRECTORY modules/config/ DESTINATION ${PROJECT_SOURCE_DIR}/build/config)
